﻿using Rbac.Domain.Entity;
using Rbac.Domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rbac.Domain.Impl
{
	public class UserRepository : IUserRepository
	{
		private readonly RbacContext db;
		public UserRepository(RbacContext db)
		{
			this.db = db;
		}

		/// <summary>
		/// 获取用户
		/// </summary>
		/// <returns></returns>
		public IQueryable<User> GetUsers()
		{
			return db.Users;
		}
		/// <summary>
		/// 登录
		/// </summary>
		/// <param name="input"></param>
		/// <returns></returns>
		public User Login(string userName, string pwd)
		{
			return db.Users.FirstOrDefault(c => c.UserName == userName && c.Password == pwd);
		}
	}
}
